<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'userdetail.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="css/common.css">
<SCRIPT type="text/javascript">
	function initSelect(){
		var x=document.getElementById("sex");
		var selectValue=x.getAttribute("init");
		for(var i=x.firstChild;i!=null;i=i.nextSibling){
			if(i.value==selectValue){
				i.selected=true;
				break;
			}
		}
		x=document.getElementById("privilege");
		selectValue=x.getAttribute("init");
		for(var i=x.firstChild;i!=null;i=i.nextSibling){
			if(i.value==selectValue){
				i.selected=true;
				break;
			}
		}
	}
</SCRIPT>
  </head>
  
  <body onload="initSelect()">
    <div class="centerdiv">
    	<s:form action="jsp_user_update.action" method="post" theme="simple">
   			<s:hidden name="username" value="%{user.username}"></s:hidden>
    		<table class="bookadd">
    			<tr >
    				<td  class="bookadd_title">修改用户</td>
    			</tr>
    			<tr><td><hr/></td></tr>
    			<tr>
    				<td align="center">
    					<table >
			    			<tr>
			    				<td>用户账号</td>
			    				<td><s:property value="%{user.username}"/></td>
			    			</tr>
			    			<tr>
			    				<td>用户密码</td>
			    				<td><s:password name="pwd" value="%{user.pwd}"></s:password></td>
			    			</tr>
			    			<tr>
			    				<td>角色</td>
			    				<td>
				    				<s:property value='%{user.privilege}' />
			    				</td>
			    			</tr>    			
			    			<tr>
			    				<td>真实姓名</td>
			    				<td><s:textfield name="name" value="%{user.name}"></s:textfield></td>
			    			</tr>
			    			<tr>
			    				<td>性别</td>
			    				<td>
				    				<select name="sex" id="sex" init="<s:property value='%{user.sex}' />">
				    					<option value="男">男</option>
				    					<option value="女">女</option>
				    				</select>    				
			    				</td>
			    			</tr>
			    			<tr>
			    				<td>地址</td>
			    				<td><s:textfield name="address" value="%{user.address}"></s:textfield></td>
			    			</tr>
			    			<tr>
			    				<td>电话</td>
			    				<td><s:textfield name="phone" value="%{user.phone}"></s:textfield></td>
			    			</tr>
			    			<tr>
			    				<td>邮编</td>
			    				<td><s:textfield name="postcode" value="%{user.postcode}"></s:textfield></td>
			    			</tr>    			
			    			<tr>
			    				<td>电子邮箱</td>
			    				<td><s:textfield name="email" value="%{user.email}"></s:textfield></td>
			    			</tr>   
			    			<tr>
			    				<td colspan="2" align="right">
			    					<s:submit value="修改"></s:submit>
			    					<s:reset value="重置"></s:reset>
			    					<a href="jsp/user/booklist.jsp">返回</a>
			    				</td>
			    			</tr>
    					</table>
    				</td>
    			</tr>
    			 			
    		</table>
    	</s:form>
    </div>
  </body>
</html>
